package com.eamois.action.graph;

import java.util.Collection;

import com.eamois.action.BaseAction;
import com.eamois.domain.graph.GraphJobCardType;
import com.eamois.domain.graph.GraphTemplate;
import com.eamois.domain.graph.GraphTemplateType;
import com.eamois.domain.graph.ManualWorkCard;
import com.eamois.service.graph.GraphTemplateService;
import com.eamois.service.graph.GraphTemplateTypeService;
import com.eamois.util.ServiceFactory;

public class GraphTemplateAction extends BaseAction{
	private GraphTemplateTypeService graphTemplateTypeService;
	private GraphTemplateService graphTemplateService;
	
	public GraphTemplateAction() {
		this.setGraphTemplateTypeService((GraphTemplateTypeService) ServiceFactory.getInstance().getBean("graphTemplateTypeService"));
		this.setGraphTemplateService((GraphTemplateService) ServiceFactory.getInstance().getBean("graphTemplateService"));
	}

	public GraphTemplateTypeService getGraphTemplateTypeService() {
		return graphTemplateTypeService;
	}

	public void setGraphTemplateTypeService(GraphTemplateTypeService graphTemplateTypeService) {
		this.graphTemplateTypeService = graphTemplateTypeService;
	}
	
	public void saveGraphTemplateType(GraphTemplateType graphTemplateType) {
		this.getGraphTemplateTypeService().save(graphTemplateType);
	}
	
	public void removeGraphTemplateType(GraphTemplateType graphTemplateType) {
		this.getGraphTemplateTypeService().remove(graphTemplateType);		
	}
	
	public Collection<GraphTemplateType> findRootGraphTemplateType() {
		return this.getGraphTemplateTypeService().findRootGraphTemplateType();
	}
	public Collection<GraphTemplate> findGraphTemplateByJobCardType(GraphJobCardType graphJobCardType){
		return this.getGraphTemplateService().findGraphTemplateByJobCardType(graphJobCardType);
	}
	public Collection<GraphTemplate> findTemplate(ManualWorkCard manualWorkCard){
		return this.getGraphTemplateService().findTemplate(manualWorkCard);
	}
	public void saveGraphTemplate(GraphTemplate graphTemplate) {
		this.getGraphTemplateService().save(graphTemplate);
	}
	
	public void removeGraphTemplate(GraphTemplate graphTemplate) {
		this.getGraphTemplateService().remove(graphTemplate);
	}
	
	public Collection<GraphTemplate> findGraphTemplateByType(GraphTemplateType graphTemplateType) {
		return this.getGraphTemplateService().findGraphTemplateByType(graphTemplateType);
	}
	
	public Collection<GraphTemplateType> findGraphTemplateTypeByParent(GraphTemplateType graphTemplateType){
		return this.getGraphTemplateTypeService().findGraphTemplateTypeByParent(graphTemplateType);
	}
	public Collection<GraphTemplateType> findeAllGraphTemplateType(){
		return this.getGraphTemplateTypeService().findAllType();
	}
	public Collection<GraphTemplate> findTemplate(String name ,String code,String scope,String remark){
		return this.getGraphTemplateService().findTemplate(name, code, scope, remark);
	}
	public GraphTemplateService getGraphTemplateService() {
		return graphTemplateService;
	}

	public void setGraphTemplateService(GraphTemplateService graphTemplateService) {
		this.graphTemplateService = graphTemplateService;
	}
}
